
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>中央民族歌舞团大型舞剧《仓央嘉措》-温州演出网</title>
 <script type="text/javascript" src="js/jquery-min.js"></script>
 <script type="text/javascript" src="js/public_js_function.js"></script>
 <link type="text/css" href="css/indexamazeui.css" rel="stylesheet" />
 <link type="text/css" href="css/m_base.css" rel="stylesheet" />
 <link type="text/css" href="css/order.css" rel="stylesheet" />
 </head>
<body>
    <style>
.header_top {
    height: 50px;
    padding: 10px;
    position: relative;
    border-bottom: 1px solid #f37b1d;
    box-shadow: 0 -1px 1px #eee;
    background: #F85709;
}
.st_back {
    position: absolute;
    left: 10px;
    width: 30px;
    height: 30px;
}
.st_back a {
    float: left;
    width: 30px;
    height: 24px;
    margin-top: 3px;
    background: url(images/st_user_ico.png) no-repeat 0 0;
    background-size: 355px auto;

}
.header_top .tit {
    padding: 0;
    margin: 0;
    color: #fff;
    height: 30px;
    line-height: 30px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 500;
}
</style>
<div class="home_top clearfix header_top">
       <div class="st_back"><a href="javascript:;" onclick="javascript:history.go(-1);"></a></div>
        <h1 class="tit">
            选择商品        </h1>
    <div class="user_login">
            <a class="" href="/shouji/user/login">登录/</a>
       <a class="" href="/shouji/user/register?forwardurl=">注册</a>
           </div>
  </div>
  <script language="JavaScript">
      var SITEURL = "/shouji/";
  </script>  <form method="post" action="/shouji/order/create"  id="bookfrm" onsubmit="return check();">
  <div class="m-main">

<div class="buy-details-hd">
            <h2 id="show_name">中央民族歌舞团大型舞剧《仓央嘉措》</h2>
                <div class="address">
                        <dd><span>2016-11-13温州大剧院</span></dd>
                </div>
     </div>
<div class="big_box">
<div class="payment buy-fare">
            <h4>选择时间：</h4>
                <ul class="clearfix" id="time">
                                                    <li class=""><a href="javascript:;" ><span>2016-11-13</span></a></li>
                                          </ul>
    </div>
    </div>

     <div class="big_box">
     <div class="payment buy-fare">
                    <h4>选择票价：</h4>
                     <ul class="clearfix" id="price">
   <li data-max="6"  class="" onclick="select_price(this)" id="" ><a href="javascript:;"><span>100</span></a></li>
   <li data-max="6"  class="" onclick="select_price(this)" id="" ><a href="javascript:;"><span>180</span></a></li>
   <li data-max="6"  class="" onclick="select_price(this)" id="" ><a href="javascript:;"><span>280</span></a></li>
   <li data-max="6"  class="" onclick="select_price(this)" id="" ><a href="javascript:;"><span>380</span></a></li>
   <li data-max="6"  class="" onclick="select_price(this)" id="" ><a href="javascript:;"><span>480</span></a></li>
   <li data-max="6"  class="" onclick="select_price(this)" id="" ><a href="javascript:;"><span>580</span></a></li>
           </ul>
    </div>
</div>

<div class="big_box">
<div class="payment buy-fare buy-num"> 
            <h4>购买数量：</h4>
                <ul class="clearfix">
                        <li class="disabled" id="prev"><a href="javascript:;"><b class="icon-reduction"></b></a></li>
                        <li><a href="javascript:;" class="buy-a-input">
<input value="1" type="text" class="com_ipt" id="num" name="num"></a>
</li>
                        <li class="disabled " id="next"><a href="javascript:;"><input type="hidden" value="6" id="next_max"><b class="icon-reduction icon-plus"></b></a></li>
                </ul>
    </div>
</div>
        <!--order start-->
<div class="big_box big_boxn">
<div class="order-dist">
   
                    <h4 class="payment-title">
<span class="order-discount">+运费:<em class="num"><i class="f12">￥</i><span class="ems" id="shipping_free_total">12.00</span></em></span>
配送方式：
    </h4>
<div class="order-dist-warp">
                    <div class="o_take_kuai shipping1_1"  >
<ul>
 <li><label class="name">姓　　名：</label><div class="ob_input"><input type="text" name="linkman" id="linkman" class="com_ipt" placeholder="" value="" /></div></li>
                                     <li><label class="name">手机号码：</label><div class="ob_input"><input type="text" name="linktel" id="linktel" class="com_ipt" placeholder="" value="" /></div></li>
 <label class="name shouhuo">收货地址：</label><div class="ob_input"><textarea name="remark" placeholder=""  style="width:275px;height: 60px;border:1px solid #e5e5e5;"></textarea></div>
 </ul>
<div class="order-tips">
<div class="order-tips-box">请详细填写以上信息。取票地址：温州市鹿城区下吕浦锦园2幢601室。</div>
</div>
</div>
</div>

  
</div>
</div>
<!--order end-->
  </div>
     <div class="f_o_price_info">
<p class="seat-pref">
商品总价:￥<em id="xz_price" name="xz_price">0.00</em> - 优惠:￥<span id="ss_sale_price">0.00</span> +运费:￥<span id="ss_shipping_free">0.00</span> <span id="ss_deduction_total"></span>
</p>
    </div>
  <div class="bom_fix_box">
  <span>总额：<em id="totalprice" name="totalprice"> &yen;0.00</em></span>
  <a class="booking" href="javascript:;"> 提交订单</a>
  <input type="hidden" id="iprice" name="iprice" value=""/>
  <input type="hidden" id="itotalprice" name="itotalprice" value=""/>
  <input type="hidden" id="iusedate" name="iusedate" value=""/>
      <input type="hidden" id="tuanid" name="tuanid" value="112"/>
  <input type="hidden" id="zhekou" name="zhekou" value="0.95"/>
  <input type="hidden" id="showstatus" name="showstatus" value="1"/>
      <input type="hidden" name="id" id="id" value="112">
      <input type="hidden" id="ordertype" name="ordertype" value="13" />
      <input type="hidden" id="suitid" name="suitid" value="0" />
      <input type="hidden" id="dateid" name="dateid" value="0" />
  </div>
  </form>
</body>
<script language="JavaScript">
    $(function(){
        //提交表单
        $(".booking").click(function(){
            $("#bookfrm").submit();
        })
    })
    function check()
    {  
        var linkman = $("#linkman").val();
        var linktel = $("#linktel").val();
var now_price = $("#price .active span").html();
var now_time = $("#time .active span").html();
    var now_totalprice = $("#totalprice").html();
document.getElementById("iprice").value = now_price;   
    document.getElementById("iusedate").value = now_time;   
document.getElementById("itotalprice").value = now_totalprice;

        var pattern = /^0?1[3|4|5|8][0-9]\d{8}$/ig;//手机
 if(!pattern.test(linktel)){
            alert('请输入正确的手机号码');
            return false;
        }

        if(isEmpty(now_time)){
           alert('请选择时间');
           return false;
        }
if(isEmpty(now_price)){
            alert('请选择票价');
            return false;
        }

        if(linkman==''){
            alert('请填写姓名');
            return false;
        }
        return true;
    }
</script>
<script type="text/javascript">
        var sche_id = "";
        var city_id = "";
        var isfamilycard = "0";
        var max_stock = "6";
        var referer = "";
var zhekou = document.getElementById("zhekou").value;
    $(function(){
        get_price_list(sche_id,city_id,isfamilycard,max_stock);
        get_schedular_dis(sche_id);
        //变更演出时间
        var elem = $('#time li');
        elem.on('click', function(){  
            elem.removeClass("active");
            $(this).addClass("active");
            var sche_id = $(this).find("a").attr("sid");
            get_price_list(sche_id,city_id,isfamilycard,max_stock);
            get_schedular_dis(sche_id);
        })
        //减
        $("#prev").click(function(){
            var max_stock_n = $("#price li ").hasClass("active");
            if(!$(this).hasClass("disabled")){
                $("#next").removeClass("disabled"); 
                var ticket_num = parseInt($("#num").val());
                if(ticket_num > 1 ){
                    var ticket_num_p = ticket_num - 1;
                }else{
                    ticket_num_p = 1;
                }
                if(ticket_num_p <= 1){
                    ticket_num_p = 1;
                    $(this).removeClass("disabled");
                    $(this).addClass("disabled");
                }
                var now_price = $("#price .active span").html();
                $("#num").val(ticket_num_p);
                check_total(now_price,ticket_num_p);
            }
        })
        //加
        $("#next").click(function(){
            if(!$(this).hasClass("disabled")){
                var now_price = $("#price .active span").html();
                if(isEmpty(now_price)){
                    var content ="您未选择票价！";
                    show_message(content);  
                    return false;
                }
                var ticket_num = parseInt($("#num").val());
                var ticket_num_n = ticket_num + 1 ;
                max_stock = get_max_stock();
                if(ticket_num_n > 1){
                    $("#prev").removeClass("disabled"); 
                }

                if(ticket_num_n > max_stock){
                    $(this).addClass("disabled"); 
                    var content ="已超过最大限制张数！";
                    show_message(content);
                    ticket_num_n = max_stock;
                }
                if(ticket_num_n == max_stock){
                    if(max_stock == 1){
                        $("#prev").removeClass("disabled"); 
                        $("#prev").addClass("disabled"); 
                    }
                    $(this).addClass("disabled");
                }
                $("#num").val(ticket_num_n);
                check_total(now_price,ticket_num_n);
            }
        })
        //手动输入张数
        $("#num").blur(function(){
            var num = $("#num").val(); 
            var now_price = $("#price .active span").html();
            var content = "";
            var ticket_num_n = "";
            if(isEmpty(now_price)){
                content ="您未选择票价！";
                show_message(content);  
                return false;
            }
            if(isNaN(num)){
                num = $("#num").val(1);
                ticket_num_n = 1;
            }
            max_stock = get_max_stock();
            if(num > max_stock){
                num = $("#num").val(max_stock);
                $("#prev").removeClass("disabled");   
                $("#next").addClass("disabled"); 
                content ="已超过最大限制张数！";
                show_message(content);
                ticket_num_n = max_stock;
            }else if(num < 1){
                num = $("#num").val(1);
                $("#next").removeClass("disabled"); 
                $("#prev").addClass("disabled");  
                ticket_num_n = 1;
            }else{
                ticket_num_n = num ;
            }
            check_total(now_price,ticket_num_n);
        });
        //下一步
        $("#get_next").click(function(){
            get_next(this);
        })
    })
    //获取票价列表
    var get_price_list = function(sche_id,city_id,isfamilycard,max_stock){
    }
    //选择票价
    var select_price = function (obj){
        var elems = $('#price li');
        elems.removeClass("active");
        $(obj).addClass("active");
        var now_price = $("#price .active span").html();
        var num = $("#num").val('1');
        $("#next").attr("class"," ");
        var stock_max_price = $(obj).attr("data-max");
        var tid = $(obj).attr("data-tid");
        num = $("#num").val();
        check_total(now_price,num);
        get_active(obj,tid,stock_max_price);
        $("#next_max").val(stock_max_price);

    }
    //计算总价

    var check_total = function (price,num){
        var price = parseFloat(price.substring());
        var num = parseInt(num);
var zhekou = document.getElementById("zhekou").value;
var showstatus = document.getElementById("showstatus").value;

        if (showstatus ==1) {
var ticket_price = price*num*zhekou;
$("#ss_shipping_free").html(12); 
var youhui = price*num-(price*num*zhekou);
$("#ss_sale_price").html(youhui); 
$("#xz_price").html(price*num); 
}else{
var ticket_price = price*num*zhekou;
var youhui = price*num-(price*num*zhekou);
    $("#ss_sale_price").html(youhui); 
$("#ss_shipping_free").html(0); 
$("#xz_price").html(price*num); 
}
    
$("#totalprice").html(ticket_price.toFixed(2));

    }
    var get_next = function(obj){
        var isload = $(obj).attr("data-isload");
        var num =  parseInt($("#num").val());                        //购票数量
        var max_stock_m = "";
        var max_stock_n   = $('#price').find(".active").attr('data-max');
        if(max_stock  > max_stock_n ){
            max_stock_m = max_stock_n;
        }else{
            max_stock_m= max_stock;
        }
        if(isload==1){
            return false;
        }
        if(!$("#price li ").hasClass('active')){
           var content ="请您选择票价！";
            show_message(content);  
            return false;
        }
        if( num > max_stock_m){
            var content ="已超过最大限制张数！";
            show_message(content);  
            return false;
        }
       
        var ticket_id = $("#price .active").attr('data-tid');        //票价id
        var sche_id = "65053";               //排期id
        
        var go_url = "/shouji/order/create";
        var code =  $("input[name=code]").val();
       
        //验证库存
    }

    //获取最大库存
    var  get_max_stock = function(){
        var max_stock_n;
        var next_max = $("#next_max").val();
var  max_stock = $('#price').find(".active").attr('data-max');
        if(isEmpty(next_max) || next_max >=max_stock){
            max_stock_n = max_stock;
        }else{
            max_stock_n = next_max;
        }
        return max_stock_n;
    }
    var get_active = function (obj,tid,limit_num){
        var _this = obj;
    }
    var get_schedular_dis = function(sche_id){
        if(sche_id){
        }
    }
</script>
</html>
